﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using EnvDTE;
using Microsoft.VisualStudio.Shell.Interop;
using WPLDB.DA.Interfaces.UI;
using System.ComponentModel.Composition;
using Microsoft.Practices.Prism.Events;
using Microsoft.VisualStudio.PlatformUI;

namespace WPLDB.Package.UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml System.Windows.Window,
    /// </summary>
    [Export(typeof(IShellView))]
    public partial class Shell : DialogWindow, IShellView
    {
        #region "ctor"
        public Shell()
        {
            InitializeComponent();
            this.IsCancel = null;
        }
        #endregion

        #region "Properties"
        public ProjectItem ProjectItem { get; set; }
        public bool? IsCancel { get; set; }
        #endregion

        #region "Override Method"
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            this.IsCancel = this.IsCancel ?? (this.IsCancel = true);
        }

        #endregion

        #region "Interface Implementation"

        public void Close(bool isCancel)
        {
            this.IsCancel = isCancel;
            base.Close();
        }

        public void SetViewModel(DA.Interfaces.UI.Base.IBaseViewModel viewModel)
        {
            this.DataContext = viewModel;
        }

        #endregion
    }
}
